package com.csoa.community.activity;

import java.util.Timer;
import java.util.TimerTask;

import android.content.Intent;
import android.view.View;

import com.collect.community.R;
import com.csoa.community.bean.IssueGroupBean;
import com.csoa.community.db.IssueGroupDB;

public class MainActivity extends BaseActivity {

	@Override
	public void initUI() {
		setContentView(R.layout.main);
		this.findViewById(R.id.tvSettingMain).setOnClickListener(
				new View.OnClickListener() {

					private IssueGroupBean mIssueGroup;
					@Override
					public void onClick(View v) {
						mIssueGroup = IssueGroupDB.query();
						Intent intent = new Intent(MainActivity.this,
								IssueGroupActivity.class);
						intent.putExtra("IssueGroup", mIssueGroup);
						startActivity(intent);
					}
				});

		this.findViewById(R.id.tvWriteDataMain).setOnClickListener(
				new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						Intent intent = new Intent(MainActivity.this,
								FormActivity.class);
						startActivity(intent);
					}
				});
		//查询统计
		this.findViewById(R.id.tvQueryMain).setOnClickListener(
				new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						Intent intent = new Intent(MainActivity.this,
								DataStatisticsActivity.class);
						startActivity(intent);
					}
				});
		
		this.findViewById(R.id.tvCanKaoMain).setOnClickListener(
				new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						Intent intent = new Intent(MainActivity.this,
								InfoQueryActivity.class);
						startActivity(intent);
					}
				});
		this.findViewById(R.id.tvHelpMain).setOnClickListener(
				new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						Intent intent = new Intent(MainActivity.this,
								HelpActivity.class);
						startActivity(intent);
					}
				});
		
		
		

	}

	private static Boolean isExit = false;
	private static Boolean hasTask = false;
	Timer tExit = new Timer();
	TimerTask task = new TimerTask() {

		@Override
		public void run() {
			isExit = false;
			hasTask = true;
		}
	};

//	@Override
//	public boolean onKeyDown(int keyCode, KeyEvent event) {
//		if (keyCode == KeyEvent.KEYCODE_BACK) {
//			if (isExit == false) {
//				isExit = true;
//				this.showToast("再按一次退出程序");
//				if (!hasTask) {
//					tExit.schedule(task, 2000);
//				}
//			} else {
//				finish();
//				System.exit(1);
//			}
//		}
//		return false;
//	}

	@Override
	public void initData() {
	}

}
